#pragma once
#include <functional>
#include "Sock.h"
#include "InetAddress.h"
#include "Channel.h"
#include "EventLoop.h"
#include "Connection.h"
class Acceptor
{
    public:
    using func_t = std::function<void(Sock*)>;
public:
    Acceptor(EventLoop *loop, const uint16_t port);
    ~Acceptor();
    void newconnection(); // 处理新客户端连接请求。

    void setnewConnectionCb(func_t func);

private:
    EventLoop *loop_;
    Sock *servSock_;
    Channel *acceptChannel_;

    func_t newConnectionCb_;
};
